import 'package:guochaoapp/model/create_order_entity.dart';

createOrderEntityFromJson(CreateOrderEntity data, Map<String, dynamic> json) {
	if (json['success'] != null) {
		data.success = json['success'];
	}
	if (json['msg'] != null) {
		data.msg = json['msg'].toString();
	}
	if (json['code'] != null) {
		data.code = json['code'] is String
				? int.tryParse(json['code'])
				: json['code'].toInt();
	}
	if (json['data'] != null) {
		data.data = new CreateOrderData().fromJson(json['data']);
	}
	if (json['sign'] != null) {
		data.sign = json['sign'];
	}
	return data;
}

Map<String, dynamic> createOrderEntityToJson(CreateOrderEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['success'] = entity.success;
	data['msg'] = entity.msg;
	data['code'] = entity.code;
	if (entity.data != null) {
		data['data'] = entity.data.toJson();
	}
	data['sign'] = entity.sign;
	return data;
}

createOrderDataFromJson(CreateOrderData data, Map<String, dynamic> json) {
	if (json['mallOrderNo'] != null) {
		data.mallOrderNo = json['mallOrderNo'].toString();
	}
	if (json['skipPayment'] != null) {
		data.skipPayment = json['skipPayment'];
	}
	return data;
}

Map<String, dynamic> createOrderDataToJson(CreateOrderData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['mallOrderNo'] = entity.mallOrderNo;
	data['skipPayment'] = entity.skipPayment;
	return data;
}